$.ajax({
    "url":"http://127.0.0.1/%E4%BC%98%E8%A1%A3%E5%BA%93/indexx.php?zpc=?",
    "type":"GET",
    "data":"hide=0",
    "dataType":"JSONP",
    "jsonp":"zpc",
    "success":data=>{
        $("input:eq(1)").blur(e=>{
        for(var i=0;i<data.length;i++){
            if(data[i]==$(e.target).val()){
                $(e.target).next().html("用户名太受欢迎").css("color","red");
                return false
            }
        }
        $(e.target).next().html("用户名可用").css("color","green");
        }) 
    }
})
$("input:eq(2)").blur(()=>{
    var pwdReg = /^[A-Za-z0-9]+$/ ;
    if(!pwdReg.test($("input:eq(2)").val())){
        $("form>div:eq(1)").html("请输入英文或者数字").css("color","red")
    }else{
        $("form>div:eq(1)").html("格式正确").css("color","green")
    }
});

$("input:eq(3)").blur(()=>{
    var pwdReg = /^[a-zA-Z0-9_-]+@[a-zA-Z0-9_-]+(\.[a-zA-Z0-9_-]+)+$/ ;
    if(!pwdReg.test($("input:eq(3)").val())){
        $("form>div:eq(2)").html("邮箱格式不正确").css("color","red")
    }else{
        $("form>div:eq(2)").html("格式正确").css("color","green")
    }
});
$("form").submit(()=>{
    if($("form>div:eq(0)").css("color")=="rgb(255, 0, 0)"||$("form>div:eq(1)").css("color")=="rgb(255, 0, 0)"||$("form>div:eq(2)").css("color")=="rgb(255, 0, 0)"){
        return false;
    }
  })


